package com.wanghao;

import java.util.ArrayList;
import java.util.List;

import com.wanghao.proxy.ModuleAdapter;
import com.wanghao.proxy.ModuleManAdapter;
import com.wanghao.ui.UiRunner;
import com.wanghao.utils.Parser;

public class ModuleMan implements ModuleManAdapter {
	private ArrayList<ModuleAdapter> moduleList;
	private UiRunner uIRunner;

	public ModuleMan() {
		super();
		moduleList = new ArrayList<ModuleAdapter>();
		uIRunner = new UiRunner(this);
	}

	@Override
	public void CreateModuleList() {
		Parser parser = new Parser();
		List<ModuleAdapter> list;
		try {
			list = parser.ParseAll();
			moduleList.addAll(list);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Override
	public void StartUI() {
		uIRunner.StartUI();
	}

	@Override
	public void AddModule(ModuleAdapter aModule) {
		this.moduleList.add(aModule);
	}

	@Override
	public List<ModuleAdapter> GetModuleList() {
		return moduleList;
	}
}
